package com.yingpai.fitness.adpter;

import android.app.Activity;
import android.support.annotation.LayoutRes;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yingpai.fitness.R;
import com.yingpai.fitness.entity.RecreationVideoBean;
import com.yingpai.fitness.entity.VideoBean;

import java.util.List;

import cn.jzvd.JZVideoPlayer;
import cn.jzvd.JZVideoPlayerStandard;


public class RecreationRecyclerAdapter extends BaseQuickAdapter<VideoBean.MapBean.PageInfoBean.ListBean, BaseViewHolder> {

    private List<RecreationVideoBean> mList;//热门/同城的数据
    private Activity mContext;//上下文/fragment/activity


    public RecreationRecyclerAdapter(@LayoutRes int layoutResId, Activity mContext) {
        super(layoutResId);
        this.mContext = mContext;
    }

    @Override
    protected void convert(BaseViewHolder helper, VideoBean.MapBean.PageInfoBean.ListBean item) {
        TextView recreation_video_data_tv = helper.getView(R.id.recreation_video_data_tv);//日期
        recreation_video_data_tv.setText(item.getVideoTitle());


        JZVideoPlayerStandard video = helper.getView(R.id.video);
        video.setUp(item.getVideoUrl(), JZVideoPlayer.SCREEN_WINDOW_LIST, item.getVideoTitle());
        Glide.with(mContext)
                .load(item.getPhotoUrl())
                .centerCrop()
                .into(video.thumbImageView);

    }
}
